var seatnum = 0;
$(".seats").click(function (event) {
    var ele = event.target;
    if (ele.classList.contains("seat")&& ele.classList.contains("selectable")&& seatnum < 4){
        ele.classList.remove("selectable");
        ele.classList.add("chosen");
        console.log(ele)
        var row = ele.parentElement.getAttribute("data-row-id")
        console.log(row);
        var col = ele.getAttribute("data-column-id");
        console.log(col)
        ele.parentElement.parentElement.parentElement.parentElement.parentElement.nextElementSibling.firstElementChild.
            nextElementSibling.nextElementSibling.firstElementChild.lastElementChild.innerHTML+="<span class=\"ticket\">"+row+"排"+col+"座"+"</span>";
        seatnum++;
    }else if (ele.classList.contains("seat")&& ele.classList.contains("chosen") && seatnum >0){
        ele.classList.remove("chosen");
        ele.classList.add("selectable");
        seatnum--;
    }
})